<?php
$controllerId = Yii::$app->controller->id;
$actionId = Yii::$app->controller->action->id;
$controller_action = $controllerId.'-'.$actionId;
?>
<ul class="nav nav-tabs">
    <li <?php if (in_array($controller_action, ['site-index','pet-detail'])):?>class="active"<?php endif;?>>
        <a href="/">首页</a>
    </li>
    <li <?php if (in_array($controller_action, ['pet-list','pet-hang-detail'])):?>class="active"<?php endif;?>>
        <a href="/pet/list">集市</a>
    </li>
    <li <?php if (in_array($controller_action, ['pet-auction-list'])):?>class="active"<?php endif;?>>
        <a href="/pet/auction-list">拍卖场</a>
    </li>
    <?php if(!is_null(Yii::$app->user->identity)):?>
    <li <?php if ($controllerId == 'user'):?> class="active"<?php endif;?>>
        <a href="/user/index" data-toggle="modal" role="button">个人中心</a>
    </li>
    <li>
        <a href="/site/logout">退出</a></li>
    <?php endif;?>
</ul>